package com.guaigen.campus.common.util;

import cn.hutool.core.util.IdUtil;

/**
 * 封装雪花算法
 */
public class SnowUtil {
    private static long dataCenterId = 1; // 数据中心
    private static long workerId = 1; // 机器标识

    public static long getSnowflakeNestId() {
        return IdUtil.getSnowflake(dataCenterId, workerId).nextId();
    }

    public static String getSnowflakeNestIdStr() {
        return IdUtil.getSnowflake(dataCenterId, workerId).nextIdStr();
    }
}
